--dofile ( "Scripts/GUI/gui.lua" )

display:create ( "GUI Demo", 800, 600, 32, true )

local gui = GUI:Create ( )

--[[
--
-- Window
--
local da = gui:CreateDragArea ( 0, 0, 800, 600 )

local window1 = gui:CreateWindow ( 30, 60, 600, 500, "Window1" )


local button1 = window1:CreateButton ( 100, 100, 80, 20, "OK" )
local button1 = window1:CreateButton ( 200, 100, 80, 20, "Cancel" )

local inputfield1 = window1:CreateInput ( 100, 150, 180 )

local hslider1 = window1:CreateHSlider ( 100, 200, 180, 20, 10 )
local vslider1 = window1:CreateVSlider ( 60, 100, 20, 120, 10 )

local list = window1:CreateList ( 100, 290, 380, 5 )
list:AddItems ( { "one", "two", "three", "four", "five", "six", "seven", "eight" } )

local cb = window1:CreateCheckbox ( 100, 60, "Checkbox" )

local sz = "AGen is a new 2D engine and framework specifically designed for the easy and rapid development of games, game prototypes or other visual applications. AGen is completely Lua scripted and allows you to make games with little overhead and without a compiler. The engine has been in the works for a while and still continues to improve."
local text = window1:CreateTextBox ( 350, 90, 200, 190 )
text:SetText ( sz )

local label = window1:CreateLabel ( 350, 60, 200, "Label" )

local vsb = window1:CreateVScrollBar ( 10, 10, 20, 300, 10, { border = 0 } )

local hsb = window1:CreateHScrollBar ( 40, 10, 400, 20, 10, { border = 0 } )

local dd = window1:CreateDropDown ( 100, 400, 200, s )
local items = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }
dd:AddItems ( items )

local a1 = window1:CreateArrow ( 340, 400, 20, 20, 'up' )

local a2 = window1:CreateArrow ( 370, 400, 20, 20, 'left' )

local a3 = window1:CreateArrow ( 400, 400, 20, 20, 'right' )

local a4 = window1:CreateArrow ( 430, 400, 20, 20, 'down' )


local window2 = gui:CreateWindow ( 400, 150, 400, 300, "Window2" )

local list2 = window2:CreateList ( 10, 10, 380, 15 )
for i, v in pairs ( display.modes ) do
    list2:AddItem ( v.width .. 'x' .. v.height .. '@' .. v.depth )
end
]]

local window1 = gui:CreateWindow ( 20, 50, 500, 310, "AGen demonstration suite", { title_font = 'Courier New' } )

local list1 = window1:CreateList ( 10, 10, 480, 15, { font = 'Courier New' } )
list1:AddItem ( "1. Moving and rotating sprites" )
list1:AddItem ( "2. Culling" )
list1:AddItem ( "3. Fluid dynamics" )
list1:AddItem ( "4. SVG Lion" )
list1:AddItem ( "5. SVG Tiger" )
list1:AddItem ( "6. Pathfinding" )
list1:AddItem ( "7. Box2D constants" )
list1:AddItem ( "8. Physics" )
list1:AddItem ( "9. Device enumeration" )
list1:AddItem ( "10. Cellular automation" )

function list1:OnSelect ( i )
    gui:Destroy ( )
    gui = nil
    if i == 1 then
        dofile ( "Scripts/Demos/bench.lua" )
    elseif i == 2 then
        dofile ( "Scripts/Demos/cull.lua" )
    elseif i == 3 then
        dofile ( "Scripts/Demos/fluid.lua" )
    elseif i == 4 then
        dofile ( "Scripts/Demos/lion.lua" )
    elseif i == 5 then
        dofile ( "Scripts/Demos/tiger.lua" )
    elseif i == 6 then
        dofile ( "Scripts/Demos/micropather.lua" )
    elseif i == 7 then
        dofile ( "Scripts/Demos/box2d.lua" )
    elseif i == 8 then
        dofile ( "Scripts/Demos/physics.lua" )
    elseif i == 9 then
        dofile ( "Scripts/Demos/devices.lua" )
    elseif i == 10 then
        dofile ( "Scripts/Demos/ca.lua" )
    end
end
